package koyi.android.learningproject;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {
	
	private static final Class[] datos =
		    new Class[]{SlidingPaneActivity.class, 
						ExpandableListViewActivity.class};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_main);
		
		if(savedInstanceState != null) {
			return;
		}		
			 
		ArrayAdapter<Class> adapter =
		    new ArrayAdapter<Class>(this, android.R.layout.simple_list_item_1, datos);
		
		this.getListView().setAdapter(adapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		Intent intent = new Intent(this, (Class)l.getItemAtPosition(position));
		startActivity(intent);
	}
}
